<?php
/**
 * 轻云网络验证系统
 * =======================================================
 * 版权所有(C) 2019-2039 daenx.cn，并保留所有权利。
 * 作者：Daen大恩
 * 作者QQ: 1330166565
 * 开发群：661059773
 * =======================================================
 */
    include 'farmwork.php';
	header("content-type:text/html;charset=utf-8");
	login();

	$action = $_GET['action'];
	if($action=='do'){
		$title = $_POST['title'];
		$keywords = $_POST['keywords'];
		$description = $_POST['description'];
		$yxtime = $_POST['yxtime'];
		$copyright = $_POST['copyright'];
		$site_name = $_POST['site_name'];
		$smtpserver = $_POST['smtpserver'];
		$smtpserverport = $_POST['smtpserverport'];
		$smtpusermail = $_POST['smtpusermail'];
		$smtpuser = $_POST['smtpuser'];
		$smtppass = $_POST['smtppass'];
		$apikey = $_POST['apikey'];
		$sql = "UPDATE `site` SET `title` = '$title',`keywords` = '$keywords',`description` = '$description', `yxtime` = '$yxtime', `copyright` = '$copyright',`apikey` = '$apikey',`smtpserver` = '$smtpserver',`smtpserverport` = '$smtpserverport',`smtpusermail` = '$smtpusermail',`smtpuser` = '$smtpuser',`smtppass` = '$smtppass'";
	    mysqli_query($con,$sql);
		mysqli_close();
		echo("<script language=\"javascript\" type=\"text/javascript\" src=\"/data/assets/js/jquery.min.js\"></script><script language=\"javascript\" type=\"text/javascript\" src=\"/data/assets/layer/layer.js\"></script><script>layer.open({  type: 1  ,title: false   ,closeBtn: false  ,area: '200px;'  ,shade: 0.8  ,id: 'LAY_layuipro'   ,resize: false  ,btn: ['确定']  ,moveType: 1   ,content: '<div style=\"padding: 30px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;\">更新成功！</div>'  ,success: function(layero){ var btn = layero.find('.layui-layer-btn');  btn.find('.layui-layer-btn0').attr({ href: 'setup.php' });  }});</script>");
	}

$li6='class="active"';
$li60='class="active"';
?>
<?php include 'header.php';?>
    <title>常规设置-<?php echo $title?></title>
<?php include 'list.php';?>
    <!--main content start-->
    <section id="main-content">
        <section class="wrapper">
<?php include 'overview.php';?>
            <div class="row">
                <div class="col-md-12">
                    <!--work progress start-->
                    <section class="panel">
                        <header class="panel-heading">
                        系统设置
                        </header>
                        <div class="panel-body">
	
           <form class="form-horizontal tasi-form" action="setup.php?action=do" method="post" role="form">
  
                                

                                    <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">title</label>
                                        <div class="col-sm-10">
                                             <input type="text" name="title" class="form-control" value='<?php echo $title?>'>
                                        </div>
                                    </div>
									<div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">keywords</label>
                                        <div class="col-sm-10">
                                             <input type="text" name="keywords" class="form-control" value='<?php echo $keywords?>'>
                                        </div>
                                    </div>
									<div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">description</label>
                                        <div class="col-sm-10">
                                             <input type="text" name="description" class="form-control" value='<?php echo $description?>'>
                                        </div>
                                    </div>

									
                                  <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">SMTP服务器</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="smtpserver" class="form-control" value='<?php echo $smtpserver?>'>
											<span class="help-block">QQ邮箱smtp.qq.com 网易云邮箱smtp.163.com，其他邮箱请自查</span>
                                        </div>
                                   </div>
								   <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">SMTP服务器端口</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="smtpserverport" class="form-control" value='<?php echo $smtpserverport?>'>
											<span class="help-block">QQ邮箱和网易云邮箱可用为：25 其他邮箱请自查</span>
                                        </div>
                                   </div>
								   <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">SMTP服务器用户邮箱</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="smtpusermail" class="form-control" value='<?php echo $smtpusermail?>'>
											<span class="help-block">你的邮箱：例如：1330166556@qq.com</span>
                                        </div>
                                   </div>
								   <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">SMTP服务器用户帐号</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="smtpuser" class="form-control" value='<?php echo $smtpuser?>'>
											<span class="help-block">和上面用户邮箱是一样的，其他邮箱请自查</span>
                                        </div>
                                   </div>
								   <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">SMTP服务器授权码</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="smtppass" class="form-control" value='<?php echo $smtppass?>'>
											<span class="help-block">SMTP服务器的授权码，不是你的密码</span>
                                        </div>
                                   </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">运行时间</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="yxtime" class="form-control" id="time1" value='<?php echo $yxtime?>'>
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">版权设置</label>
                                        <div class="col-sm-10">
                                            
											<input type="text" name="copyright" class="form-control" value='<?php echo $copyright?>'>
                                        </div>
                                    </div>
									
									
									<div class="form-group">
                                        <label class="col-sm-2 col-sm-2 control-label">接口KEY<input class="btn btn-primary btn-xs" type= "button" name= "Submit1 " value= "生成" onclick= "show()"></label>
                                        <div class="col-sm-10">
                                            <input type="text" name="apikey" id="syskey" class="form-control" value='<?php echo $apikey?>'>
											<input type="text"  disabled="disabled" name="" id="" class="form-control" value='md5加密后的：<?php echo md5($apikey)?>'>
											<span class="help-block"> <font color="red">可手动输入也可点击生成，私有api需要提交key，以此来保证安全性(需要经过特定加密，具体看帮助文档问题FAQ)</font></span>
                                        <script language=javascript> 
						function show() 
						{ 
						var str= "0123456789abcdefghijklmnopqrstuvwxyz" 
						var result= " " 
						for(var i=0;i <32;i++) 
						{ 
						var temp=Math.floor(Math.random()*36) 
						result+=str.charAt(temp) 
						} 
						hash = result.MD5();
						document.getElementById( "syskey").value=hash
						} 
					</script>
										</div>
                                    </div>
									
									



                                
			<div id="bottom" class="form-group">
			<label class="col-sm-2 col-sm-2 control-label"></label>
			  <button class="btn btn-info btn-lg" type="submit" value="true" id="submit"/><i class="fa fa-refresh" id="spinner"></i> <span id="btnText">更新设置</span></button>
            </div>
                            </form>
                        </div>
                    </section>
                    <!--work progress end-->
                </div>

        </section>
    </section>
    <!--main content end-->

<?php include 'footer.php';?>